#import strip
from collections.abc import Iterable
from collections.abc import Iterator
ls1 = list(range(0,100))
#print(ls1[0:10:2])
#print(ls1[:50:5])
#print(ls1[:2])

def trim(str):
    if len(str) == 0:
        return str
    elif str[0] == ' ':
        return trim(str[1:])
    elif str[-1] == ' ':
        return trim(str[:-1])
    else:
        return str

#print(trim('  ab    '))

def trim2(str):
    return str.strip()
#print(trim2('  ab    '))

dic = {'name':'Bob','age':20,'score':88}
for key,value in dic.items():
    #print(key,'=',value)
    pass
for key in dic:
    #print(key,'=',dic[key])
    pass
for value in dic.values():
    pass
    #print(value)

str = '2aABcDeFGHJkk'
#print(isinstance(str,Iterable))

for i,value in enumerate(str):
    #print(i,value)
    pass

for k in str:
    #print(k.lower())
    pass

def fib(max):
    n, a, b = 0, 0, 1
    while n < max:
        #print(b)
        yield b
        a, b = b, a + b
        n = n + 1
    return 'done'
#fib(6)


def triangles():
    row=[1]
    while True:
        yield row
        row=[x+y for x,y in zip([0]+row,row+[0])]

t = triangles()
#print(next(t))
#print(next(t))
#print(next(t))

#ls2 = list(range(10))
ls2 = range(10)
print(ls2)
print(isinstance(ls2,Iterator))

it = iter(ls2)
print(isinstance(it,Iterator))
while True:
    try:
        x = next(it)
        print(x)
    except StopIteration:
        break


